//
//  PicTableViewCell.m
//  HumorousSript
//
//  Created by 李欢 on 15/6/17.
//  Copyright (c) 2015年 李欢. All rights reserved.
//

#import "PicTableViewCell.h"
#define Width [UIScreen mainScreen].bounds.size.width
#define Height [UIScreen mainScreen].bounds.size.height

@implementation PicTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if ( self) {
        
        self.imageview = [[UIImageView alloc]initWithFrame:CGRectMake(10/375.0*Width, 10/667.0*Width, 40/375.0*Width, 40/667.0*Height)];
        //        图片变成圆角
        self.imageview.layer.cornerRadius = 20;
        self.imageview.clipsToBounds = YES;
        
        //        名字
        self.nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(60/375.0*Width, 10/667.0*Width, 300/375.0*Width, 30/667.0*Height)];
//        文字
        self.wordsLabel = [[UILabel alloc]initWithFrame:CGRectMake(20/375.0*Width, 50/667.0*Height, 300/375.0*Width, 30/667.0*Height)];
//        图片
        self.picView = [[UIImageView alloc]initWithFrame:CGRectMake(10/375.0*Width, 90/667.0*Height, [UIScreen mainScreen].bounds.size.width - 20/375.0*Width, self.y - 20/667.0*Height)];
        [self.picView setBackgroundColor:[UIColor whiteColor]];
        
        self.view1 = [[UIView alloc] initWithFrame:CGRectMake(0, 80/667.0*Height + _y, [UIScreen mainScreen].bounds.size.width, 30/667.0*Height)];
        
        
        self.LastView = [[PicView alloc] initWithFrame:CGRectMake(25/375.0*Width, 0, self.view1.frame.size.width / 4/375.0*Width, 30/667.0*Height)];
//        self.LastView.image.image = [UIImage imageNamed:@"iconfont-zanxuanzhong.png"];
        [self.view1 addSubview:self.LastView];
        self.LastView1 = [[PicView alloc] initWithFrame:CGRectMake(self.view1.frame.size.width / 4.0 + 20/375.0*Width, 0, self.view1.frame.size.width / 4.0, 30/667.0*Height)];
//        self.LastView1.image.image = [UIImage imageNamed:@"iconfont-zanweixuanzhong-2.png"];
        
        [self.view1 addSubview:self.LastView1];
        
        self.LastView2 = [[PicView alloc] initWithFrame:CGRectMake(self.view1.frame.size.width / 4.0 * 2.0 + 20, 0, self.view1.frame.size.width / 4.0, 30/667.0*Height)];
//        self.LastView2.image.image = [UIImage imageNamed:@"iconfont-remen.png"];
        
        [self.view1 addSubview:self.LastView2];
        
        UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(self.view1.frame.size.width / 4.0 * 3.0, 0, self.view1.frame.size.width / 4.0, 30/667.0*Height)];
//        [button setImage:[UIImage imageNamed:@"4.png"] forState:UIControlStateNormal];
        [button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
        [self.view1 addSubview:button];
        
        [self.contentView addSubview:_view1];

        
        [self.contentView addSubview:self.imageview];
        [self.contentView addSubview:self.nameLabel];
        [self.contentView addSubview:self.wordsLabel];
        [self.contentView addSubview:self.picView];
        
    }
    return self;
}

- (void)setAlabelFrame
{
    
    [self.picView setFrame:CGRectMake(10/375.0*Width, 90/667.0*Height, [UIScreen mainScreen].bounds.size.width - 20/667.0*Height, _y - 80/667.0*Height)];
    [self.view1 setFrame:CGRectMake(0, 80/667.0*Height + _y, [UIScreen mainScreen].bounds.size.width, 30/667.0*Height)];

}
- (void)buttonAction:(id)sender
{
    NSLog(@"%@", self.share);
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
